<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>
<!--后台UI组件Start-->
<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI.jspf" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>日活动</title>
        <script src="dc_manager/base/scheme/combo/fl/lookup/comboflLookUp.js" type="text/javascript"></script>
        <script src="dc_manager/base/scheme/promotions/js/promotionsDay.js" type="text/javascript"></script>
        <script src="zj/my/Month.js" type="text/javascript"></script>
        <script>
            $(function () {
                f_dc_base_promotionsDay("ID_showMonth", monthDate, f_selectByMonth);
                GRID = $("#divID_GRID").ligerGrid({
                    columns: [
                        {display: '活动日期', name: 'promotion_date', type: 'date', width: 100}
                        , {display: '活动价', name: 'promotion_price', width: 60, align: 'left', type: 'float'}
                        , {display: '活动数量', name: 'promotion_number', width: 60, align: 'left', type: 'float'}
                        , {display: '活动剩余', name: 'promotion_now_number', width: 60, align: 'left', type: 'float'}
                        , {display: '活动ID', name: 'promotion_id', hide: true}
                        , {display: '食物ID', name: 'food_id', hide: true}
                        , {display: '名称', name: 'food_name', width: 130, align: 'left'}
                        , {display: '编码', name: 'food_code', width: 110, align: 'left'}
                        , {display: '原价', name: 'food_price', width: 60, align: 'left'}//带出食物档案的价格。可以再次调整
                        , {display: '单位ID', name: 'unit_id', hide: true}
                        , {display: '单位', name: 'unit_name', width: 40, align: 'left'}
                    ]
                    , usePager: true
                    , url: 'weixinkeji/dev/dc/base/scheme/promotions/s/selectAll.imy'
                    , dateFormat: "yyyy-MM-dd"
                    , width: '750px'
                    , height: '97%'
                    , pageSizeOptions: [50, 100, 200, 500, 1000]
                    , pageSize: 100
                });
                $("#toptoolbar").ligerToolBar({items: [
//                        {text: '修改', click: update}
//                        , {line: true}
                        {text: '增加', click: add}
                        , {line: true}
                        , {text: '删除', click: dell}
                        , {line: true}
                        //                        , {text: '复制BOM', click: copyBOM}
                    ]});
                iniYear("mySelectYear");
            });

            function iniYear(id) {
                var date = new Date();
                $("#" + id).val(date.getFullYear());
            }

            function f_selectByMonth(v) {
                var year = $("#mySelectYear").val();
                GRID.setParm("year", year);
                GRID.setParm("month", v.data.id);
                GRID.reload();
            }

            function update() {

            }
            var ADD;
            function add() {
                ADD = openURL_Event("活动添加", ADD, "dc_manager/base/scheme/promotions/promotionDay1_A.jsp", 400, 900, f_d);
                ADD.max();
                function f_d() {
                    ADD = null;
                    GRID.reload();
                }
            }
            function dell() {
                var rows = GRID.getSelectedRows();
                var ids = "";
                for (var i = 0; i < rows.length; i++) {
                    ids = ids + "," + rows[i]["promotion_id"];
                }
                ids = ids.substring(1);
                if (rows.length < 1) {
                    msg_tip("操作提示", "请选择行", 200, 50);
                    return;
                } else {
                    if (post_json("weixinkeji/dev/dc/base/scheme/promotions/d/dell.imy", {"ids": ids})) {
                        GRID.reload();
                    }
                }
            }
        </script>
    </head>
    <body>
        <div>
            <div  style="float:left">
                <div style="margin: 10px;">
                    <input type="text" value="" id="mySelectYear"/>
                </div>
                <div id="ID_showMonth">

                </div>
            </div>
            <div  style="float:left">
                <div id="toptoolbar"></div> 
                <div id="divID_GRID" style="margin:0; padding:0"></div>
            </div>
        </div>
    </body>
</html>
